/********************
 *	系统全局配置信息
 ********************/
define(function(require){
	var win = window;
	var host = win.location.host;
	var ROOT = win.ROOT;
	var USER = win.APP_USERDATA;
	var SITE = USER && USER.site;
	var SITEBASE = win.APP_SITEBASE || '';
	var $ = require('jquery');
	var util = require('util');
	var dspUtil = require('dspUtil');
	var CONST = require('CONST');

	var info = window.APP_THEME || {};

	var report_menu = [ // 基础菜单
		{text:_T("计划"), alias:_T("计划"), link: "#plan", navRight: "admin.plan", addName:'Plan', icon:'icon-plan'},
		{text:_T("推广组"), alias:_T("推广组"), link: "#campaign", navRight: "admin.campaign", addName:'Campaign', icon:'icon-campaign'},
		{text:_T("创意包"), alias:_T("创意包"), link: "#sweety", navRight: "admin.sweety", addName:'Sweety', icon:'icon-sweety'},
		{text:_T("落地页"), alias:_T("落地页"), link: "#whisky", navRight: "admin.whisky", addName:'Whisky', icon:'icon-whisky'},
		{text:_T("产品"), alias:_T("产品"), link: "#product", navRight: "admin.product", icon:'icon-product'},
		{text:_T("条件列表"), alias:_T("条件"), link: "#condition", navRight: "admin.condition", icon:'icon-condition'},
		{text:_T("素材组列表"), alias:_T("素材组"), link: "#materialGroup", navRight: "admin.materialGroup"},
	];

	var admin_menu = [
		 {text:_T("管理中心"), alias:_T("管理"), icon:'icon-tools', items:[
			 {text:_T("客户管理"), alias:_T("客户"), link: "#admin/customer", navRight: 'agent.user'},
			 //{text:_T("财务申请"), alias:_T("财务"), link: "#admin/financeAudit", navRight: 'administrator.financeAudit'},
			 //{text:_T("发票管理"), alias:_T("发票"), link: "#admin/invoiceManage", navRight: 'invoice.audit'},
			 {text:_T("资质管理"), alias:_T("资质"), link: "#admin/aptitude", navRight: 'agent.qualification'},
			 //{text:_T("公告管理"), alias:_T("公告"), link: "#admin/messageManage", navRight: 'administrator.message'},
			 //{text:_T("操作日志"), alias:_T("日志"), link: "#admin/log", navRight: "admin.operationLog"},
			 //{text:_T("帮助中心"), alias:_T("帮助"), link: "#admin/help", navRight: "administrator.help"},
			 //{text:_T("订单管理"), alias:_T("订单"), link: "#admin/deal", navRight: 'administrator.deal'},
		 ]
		 },
		 {text:_T("用户中心"), alias:_T("用户"), icon:'icon-user', items:[
			 //{text:_T("财务中心"), alias:_T("财务"), link: "#user/financeCenter", navRight: 'admin.bill'},
			 //{text:_T("发票管理"), alias:_T("发票"), link: "#user/invoiceDetail", navRight: "admin.invoice"},
			 //{text:_T("消息公告"), alias:_T("消息"), link: "#user/message", navRight: "admin.usermessage"},
			 //{text:_T("代码中心"), alias:_T("代码"), link: "#user/codeCenter"},
			 //{text:_T("运营日志"), link: "#user/runninglog", navRight: "admin.operationRemark"},
			 //{text:_T("帮助中心"), alias:_T("帮助"), link: "#user/help", navRight: "admin.help"},
			 {text:_T("监控消息"), alias:_T("监控"), link: "#user/messageMonitor", navRight: "monitor.noticeList"},
			 {text:_T("智能监控"), alias:_T("智能"), link: "#user/smartMonitor", navRight: "monitor.listAlarms"}
			 //{text:_T("人群标签"), alias:_T("人群"), link: "#user/peopleTag"}
		 ]
		 }
	];

	// 品牌版report
	var report_menu_brand = [
		{text:_T("首页"), alias:_T("首页"), link: "#main", navRight: "", icon:''},
		{text:_T("投放管理"), alias:_T("投放"), link: "#serving", navRight: "", icon:''},
		{text:_T("报表中心"), alias:_T("报表"), navRight: "", icon:'', items:[
			{text:_T("资源报表"), alias:_T("资源"), link: "#report/resource"},
			{text:_T("汇总报表"), alias:_T("汇总"), link: "#report/summary"},
			{text:_T("自定义报表"), alias:_T("自定义"),  link: "#report/custom"},
		]},
		{text:_T("管理中心"), alias:_T("管理"), navRight: "", icon:'', items:[
				{text:_T("子账号管理"), alias:_T("子账号"), link: "#admin/customer"},
				{text:_T("广告主管理"), alias:_T("广告主"), link: "#admin/aptitude"},
				{text:_T("定向策略"), alias:_T("定向"), link: "#admin/orientation"},
				{text:_T("监控设置"), alias:_T("监控"), link: "#admin/smartMonitor"},
				{text:_T("监控消息"), alias:_T("消息"), link: "#admin/messageMonitor"},
				{text:_T("黑名单"), alias:_T("黑名单"), link: "#admin/blacklist"},
				{text:_T("代码中心"), alias:_T("代码"), link: "#admin/codeCenter"},
				{text:_T("特殊溢价设置"), alias:_T("溢价"), link: "#admin/premium"},
				{text:_T("财务中心"), alias:_T("财务"), link: "#admin/financeCenter"},
				{text:_T("人群标签"), alias:_T("人群"), link: "#admin/peopleTag"}
		]},
		// {text:_T("用户中心"), alias:_T("用户"), navRight: "", icon:'', items:[
		// 	{text:_T("财务中心"), alias:_T("财务"), link: "#user/financeCenter", navRight: 'admin.bill'},
		// ]}
	];

	// 品牌版admin
	var admin_menu_brand = [

	];

	var video_type = CONST.VIDEO_TYPE;

	return {
		// 调试模式
		debug: 2,
		// 默认路由入口
		router: {
			default_module: 'home',
			default_action: 'main',
			login_module: 'login',
			login_action: 'main',
			no_right: 'noright',
			publics: ['login', 'privacy']
		},
		// 系统名称
		app_title: info.title,
		// 系统CopyRight
		app_footer: info.copyright,
		// 系统Logo
		app_logo: {
			title: info.title,
			small: ROOT(info.logo || ''),
			big: ROOT(info.big_logo || ''),
			smaller: ROOT(info.small_logo || "resources/images/logo_smaller.png")
		},
		// 系统CopyRight
		app_copyright: info.copyright,
		// 是否显示隐私控制
		app_show_privacy: +info.show_privacy || '',
		// 代码中心独立PDMP数据采集域名
		app_custom_domain: info.custom_domain || '',
		// 代码中心基础统计代码
		app_custom_domainA: info.custom_domainA || '',
		// 代码中心1像素图片／Flash版PDMP代码收集
		app_custom_domainB: info.custom_domainB || '',
		// 代码中心1像素图片统计注册
		app_custom_domain1px: info.custom_domain1px || '',
		// 登陆url
		loginUrl: '',
		// 登陆cookie信息
		login: {
			cookie_expires: 30, // 保存30天
			user_cookie_name: 'bx_user_cookie',
			user_sessionId: 'sessionId',
			user_rememberId: 'rememberId'
		},
		login_title: _T('用户登陆'),
		app: {
			isDebug: false,
			mc: {
				"uri_prefix": "/DSP/",	//普通用户
				"prefix": {
					"/": "default://",
					"/test/": "test://"
				},
				"remotes": {
					"default": {
						"type": "websocket",
						"path": '/api/dsp/ws',
						// "transports": ['websocket', 'polling'],
						"transports": ['websocket'],
						"url": "http://" + host
					},
					"local": {
						"type": "local"
					},
					// 静态测试文件
					"test": {
						"type": "file",
						"base": "/data/test/" // 静态测试文件存储路径
					}
				}
			},
			// 表格对比
			subgrid: {
				// 汇总渠道
				'amount_channel': {
					'modules': {
						'uri': 'subgrid/amount.channel',
						'config': {
							'url': 'campaign/amountSubgrid',
							'gridName': 'campaign_amountSubgrid',
							'gridNameSuffix': '_channel',
							'subName': 'amount_channel',
							'hasDateRange': true,
							'syncParentGridParam': true
						}
					}
				},
				// 汇总时段
				'amount_period': {
					'modules': {
						'uri': 'modules/chart.period',
						//'uri': 'subgrid/amount.period',
						'config': {
							'url': 'campaign/amountSubgrid',
							'gridName': 'campaign_amountSubgrid',
							'gridNameSuffix': '_period',
							'subName': 'amount_period',
							'syncParentGridParam': true,
							'gridParam': {
								'Type': 'period'
							}
						},
						'param': {
							'Type': 'period'
						}
					}
				},
				// 汇总地区
				'amount_region': {
					'modules': {
						'uri': 'subgrid/region.base',
						'config': {
							'url': 'campaign/amountSubgrid',
							'gridName': 'campaign_amountSubgrid',
							'gridNameSuffix': '_region',
							'subName': 'amount_region',
							'syncParentGridParam': true
						},
						'param': {
							'Type': 'region'
						}
					}
				},
				// 媒体&广告位
				'mediaAndAd_lite': {
					'modules': {
						'uri': 'subgrid/mediaAndAd.lite',
						'config': {
							'isRTB': true,
							'subName': 'mediaAndAd_lite'
						}
					}
				},
				// 媒体&广告位 -监测活动 -选项卡
				'mediaAndAd_Monitor': {
					'modules': {
						'uri': 'subgrid/mediaAndAd.base',
						'config': {
							'isRTB': false,
							'subName': 'mediaAndAd_Monitor'
						}
					}
				},
				// 创意包
				'sweety': {
					'title': _T('创意包'),
					'modules': {
						'uri': 'sweety/grid/sweety.subSweetyGrid',
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'sweety',
							'hasDateRange': true,
							'syncDateParam': true
						}
					}
				},
				// 落地页
				'whisky': {
					'title': _T('落地页'),
					'modules': {
						'uri': 'whisky/grid/whisky.base',
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'whisky',
							'hasDateRange': true,
							'syncDateParam': true
						}
					}
				},
				// 时段分析 -图表
				'period': {
					'modules': {
						'uri': 'modules/chart.period',
						'config': {
							'subName': 'period'
						}
					}
				},
				// 频次对比 -图表
				'frequency': {
					'modules': {
						'uri': 'modules/chart.frequency',
						'config': {
							'subName': 'frequency'
						}
					}
				},
				// 地域 -图表
				'region': {
					'modules': {
						'uri': 'subgrid/region.base',
						'config': {
							'subName': 'region'
						}
					}
				},
				// 客户端 -选项卡
				'client': {
					'modules': {
						'uri': 'subgrid/client.base',
						'config': {
							'subName': 'client'
						}
					}
				},
				// 产品 -选项卡
				'product': {
					'modules': {
						'uri': 'subgrid/product.base',
						'config': {
							'subName': 'product'
						}
					}
				},
				// 活动
				'campaign': {
					'title': _T('活动'),
					'modules': {
						'uri': 'campaign/grid/campaign.subGrid',
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'campaign',
							'hasDateRange': true,
							'syncDateParam': true
						}
					}
				},
				// 创意
				'creative': {
					'title': _T('创意'),
					'modules': {
						'uri': 'subgrid/creative.base',
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'creative',
							'hasDateRange': true,
							'syncDateParam': true
						}
					}
				},
				'channelCategory': {
					'title': _T('频道分类'),
					'modules': {
						'uri': 'subgrid/channelCategory.base',
						'config': {
							'subName': 'channelCategory'
						}
					}
				},
				'channelCategory2': {
					'title': _T('二级频道分类'),
					'modules': {
						'uri': 'subgrid/channelCategory.base2',
						'config': {
							'subName': 'channelCategory2'
						}
					}
				},
				// 汇总地区
				'amount_channelCategory': {
					'modules': {
						'uri': 'subgrid/channelCategory.amount',
						'config': {
							'subName': 'amount_channelCategory',
							// 'syncParentGridParam': true
						},
						'param': {

						}
					}
				},
				// 直客列表
				'admin_direct': {
					'modules': {
						'uri': 'admin/customer/action/list.main',
						'config': {
							'isSubGrid': true,
							'hasSearch': true,
							'subs': ['admin_cost'],
							'class': 'P-dspUser',
							'hasHead': false,
							'grid_config': {
								'hasFilter': false
							},
							'subName': 'admin_direct',
							'uuid': util.uuid()
						}
					}
				},
				//todo  客户报表的子表格消费明细报表
				'admin_cost': {
					'modules': {
						'uri': 'admin/customer/grid/costGrid.base',
						'config': {
							'hasAmount': false,
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'admin_cost'
						}
					}
				},
				// 汇总订单客户列表
				'deal_customer': {
					'modules': {
						'title': _T('客户报表'),
						'uri': 'admin/customer/grid/dealCustomer.base',
						// 'uri': 'admin/customer/action/list.main',
						'config': {
							'class': 'M-HighGrid P-dspUser',
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'deal_customer',
							'syncDateParam': true,
							'hasDateRange': true,
							'userStorageDate': false,
							'dateRange': {
								'userStorage': false
							}
						}
					}
				},
				// 汇总广告位客户子表格
				'spot_customer': {
					'modules': {
						'title': _T('客户报表'),
						'uri': 'admin/customer/grid/customer.spot',
						'config': {
							'class': 'M-HighGrid P-dspUser',
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'spot_customer',
							'syncDateParam': true,
							'hasDateRange': true,
							'userStorageDate': false,
							'dateRange': {
								'userStorage': false
							}
						}
					}
				},
				// 落地页
				'overview_whisky': {
					'title': _T('落地页'),
					'modules': {
						'uri': 'whisky/grid/whisky.base',
						'param':{
							'get_all_info': 1,
							'ListAll':1,
							'showChildren':1,
							'overview_subgrid':1
						},
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'overview_whisky',
							'syncDateParam': true,
							'hasDateRange': true,
							'userStorageDate': false,
							'dateRange': {
								'userStorage': false
							}
						}
					}
				},
				// 产品 -选项卡
				'overview_product': {
					'modules': {
						'uri': 'subgrid/product.base',
						'param':{
							'get_all_info': 1,
							'ListAll':1,
							'showChildren':1,
							'overview_subgrid':1
						},
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'overview_product',
							'uuid': util.uuid()
						}
					}
				},
				// 活动
				'overview_campaign': {
					'title': _T('活动'),
					'modules': {
						'uri': 'campaign/grid/campaign.subBase',
						'param':{
							'get_all_info': 1,
							'ListAll':1,
							'showChildren':1,
							'overview_subgrid':1
						},
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'overview_campaign',
							'syncDateParam': true,
							'hasDateRange': true,
							'userStorageDate': false,
							'dateRange': {
								'userStorage': false
							}
						}
					}
				},
				// 创意
				'overview_creative': {
					'title': _T('创意'),
					'modules': {
						'uri': 'subgrid/creative.base',
						'param':{
							'get_all_info': 1,
							'ListAll':1,
							'showChildren':1,
							'overview_subgrid':1
						},
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'overview_creative',
							'syncDateParam': true,
							'hasDateRange': true,
							'userStorageDate': false,
							'dateRange': {
								'userStorage': false
							}
						}
					}
				},
				// 时段 -图表
				'overview_period': {
					'modules': {
						'uri': 'modules/chart.period',
						'param':{
							'overview_subgrid':1
						},
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'overview_period'
						}
					}
				},
				// 频次对比
				'overview_frequency': {
					'modules': {
						'uri': 'modules/chart.frequency',
						'param':{
							'overview_subgrid':1
						},
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'overview_frequency'
						}
					}
				},
				// 地域
				'overview_region': {
					'modules': {
						'uri': 'subgrid/region.base',
						'param':{
							'overview_subgrid':1
						},
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'overview_region'
						}
					}
				},
				// 客户端 -选项卡
				'overview_client': {
					'modules': {
						'uri': 'subgrid/client.base',
						'param':{
							'get_all_info': 1,
							'ListAll':1,
							'showChildren':1,
							'overview_subgrid':1
						},
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'overview_client',
							'uuid': util.uuid()
						}
					}
				},
				// 对比创意包
				'compare_sweety': {
					'title': _T('创意包'),
					'modules': {
						'uri': 'subgrid/compare/main.sweety',
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'compare_sweety',
							'hasDateRange': true,
							'syncDateParam': true
						}
					}
				},
				// 对比落地页
				'compare_whisky': {
					'title': _T('落地页'),
					'modules': {
						'uri': 'subgrid/compare/main.whisky',
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'compare_whisky',
							'hasDateRange': true,
							'syncDateParam': true
						}
					}
				},
				// 对比广告位
				'compare_spot': {
					'title': _T('广告位'),
					'modules': {
						'uri': 'subgrid/compare/main.spot',
						'config': {
							'hasSearch': false,
							'hasFilter': false,
							'subName': 'compare_spot',
							'hasDateRange': true,
							'syncDateParam': true
						}
					}
				},
				// 对比时段分析
				'compare_period': {
					'modules': {
						'uri': 'subgrid/compare/period.period',
						'config': {
							'subName': 'compare_period',
							'gridParam': {
							}
						}
					}
				}
			}
		},
		// 全局站点ID
		site_id: SITE && SITE.id || 0,
		// 站点首目录
		site_base: SITEBASE,
		// 站点地址格式化字符串
		site_url: SITEBASE + '%1/',
		// 自动登录用户数据
		user_data: USER,
		// 控制器所在目录
		app_base: ROOT('controller/'),
		// 中间件基础目录
		plugin_base: 'plugins/',
		// 模板文件基础路径
		template_base: ROOT('tpl/'),
		// 预览文件地址
		preview_url: ROOT('preview.html?id={1}&type={2}'),
		// 图片缩略工具地址
		thumb_script: "{1}&h={2}&w={3}",
		dateType: '',
		PLATFORM: {
			modules: [
				// platform头部(Head)
				{
					name: 'header', uri: 'layout/header.base', target: 'head', config: {
					modules: [
						// 用户工具栏模块(Head)
						{name: 'toolbar', uri: 'layout/userToolbar.base', target: 'toolbar', config: {}},
						{name: 'account', uri: 'layout/account.base', target: 'account', config: {}},
						// 语言切换模块(Head)
						{
							name: 'language', uri: 'layout/language.base', target: 'language', config: {
							'list': [
								{"name": _T("简体中文"), "icon": 'M-languageCN', "type": "zhCN"},
								{"name": _T("繁体(香港)"), "icon": 'M-languageHK', "type": "zhHK"},
								{"name": _T("繁体(台湾)"), "icon": 'M-languageTW', "type": "zhTW"},
								{"name": _T("English"), "icon": 'M-languageEN', "type": "enUS"}
							]
						}
						},
/*						// 消息公告(Head)
						{name: 'message', uri: 'layout/message.base', target: 'message', config: {}},*/
/*						// 智能监控消息(Head)
						{name: 'monitor', uri: 'layout/message.monitor', target: 'monitor', config: {}},*/
						// 问题(Head)
						{
							name: 'question', uri: 'layout/question.base', target: 'question', config: {
							'list': [
								{"name": _T("切换显示货币"), "uri": "switchCurrency"},
								// {"name": _T("常见问题"), "uri": "#user/help", "target": '_blank'},
								{"name": _T("代码中心"), "uri": "#admin/codeCenter", "target": '_blank'},
								{
									"name": _T("切换语言"), "uri": "javascript:void(0);", "items": [
									{"name": _T("简体中文"), "type": "zhCN"},
									{"name": _T("繁体(香港)"), "type": "zhHK"},
									{"name": _T("繁体(台湾)"), "type": "zhTW"},
									{"name": _T("English"), "type": "enUS"}
								]
								},
								{"name": _T("财务中心"), "uri": "#admin/financeCenter", "target": '_blank'},
								// {"name": _T("问题反馈"), "uri": "#feedback", right: 'feedback.add'},
								{"name": _T("退出登录"), "uri": "#login/logout"}
							]
						}
						},
						// 切换产品(head)
						{
							name: 'switchProduct',
							uri: 'layout/switchProduct.base',
							target: 'switchProduct',
							config: {}
						}
					]
				}
				},
				// 菜单logo模块
				{name: 'logo', uri: 'layout/logo.base', target: 'logo'},

				// 菜单模块
				{name: 'menu', uri: 'layout/nav.base', target: 'menuList'},

				// 报表与后台切换
				{name: 'switch', uri: 'layout/switch.base', target: 'switch', config: {}},

				// 弹出表格模块
				// {name: 'pop_grid', uri: '@layout/v1/popGrid.base', target: 'SCENES_POPGRID'},

				// 弹出表格模块
				{
					name: 'pop', uri: '@layout/v1/popbar.base', target: 'SCENES_POP', config: {
					'crumb': {
						'modName': 'crumb',
						'uri': 'modules/crumb.crumb',
						'config': {}
					}
				}
				}
			]
		},
		app_user_toolbar: [
			// {text:_T("个人信息"), link: "#user/account"},
			// {text:_T("修改密码"), link:"#user/password"}
		],

		// 数据中心参数配置
		data: {
			max_query: 10,
			points: {
				'/tpl': ROOT('tpl/'),
				'/i18n': ROOT('i18n/'),

				// 登陆
				'/login': '/login',
				'/logout': '/logout'
			}
		},

		// 多语言配置
		language: {
			'default': 'zhCN',
			'cookie': 'lang',
			'style': ROOT('i18n/')
		},

		exchange: null,
		allExchange: null,
		channelMap: null,
		pcChannel: null,
		mobileChannel: null,
		// 默认图片
		/*		default_img: {
		 'default': ROOT('resources/images/default.png'),
		 'product': ROOT('resources/images/default.png'),
		 'sweety': ROOT('resources/images/default.png'),
		 'package': ROOT('resources/images/default.png'),
		 'creative': ROOT('resources/images/default.png'),
		 'whisky': ROOT('resources/images/default.png')
		 },*/

		video_type: video_type,
		// 上传组件配置
		uploader: {
			// 创意素材
			creative: {
				url: '/api/dsp/upload?type=sweetyCreative',
				filters: {
					mime_types: [ //只允许上传图片文件和rar压缩文件
						{title: "图片文件", extensions: "jpg,jpeg,gif,png"},
						{title: "Flash文件", extensions: "swf,flv"},
						{title: "视频文件", extensions: video_type}
					],
					max_file_size: '20mb'								// 视频素材最大为20mb，其他最大只能上传100kb的文件
				},
				tips: _T('请上传：jpg,jpeg,png,gif, swf,flv文件。图片文件尺寸小于100kb。视频文件尺寸小于10M。可批量上传，每个尺寸只能上传一个！')
			},
			// 上传封面
			cover: {
				url: '/api/dsp/upload?type=cover',
				filters: {
					mime_types: [
						{title: "图片文件", extensions: "jpg,gif,png"}
					],
					max_file_size: '1mb'
				},
				tips: _T('上传封面以便管理，请上传：jpg,png,gif文件。文件尺寸小于1MB。'),
				subModule: 'modules/upload.cover',
				hasProgress: false,
				multi_selection: false
			},
			// 资质证件传图
			certificate: {
				url : '/api/dsp/upload?type=certificate',
				filters: {
					mime_types : [
						{ title : "图片文件", extensions : "jpg,gif,png,jpeg" }
					],
					max_file_size : '1mb'
				},
				tips: _T('请上传：jpg,png,jpeg,gif文件。文件尺寸小于1MB。'),
				subModule: 'modules/upload.certificatie',
				multi_selection: false
			},
			// 资质证件传图
			certificate_zip: {
				url : '/api/dsp/upload?type=certificateZip',
				filters: {
					mime_types : [
						{ title : "压缩文件", extensions : "zip" }
					],
					max_file_size : '3mb'
				},
				tips: _T('请上传：zip文件。文件尺寸小于3MB。'),
				subModule: 'modules/upload.certificatie',
				multi_selection: false
			},
		},

		// 素材预览地址
		materialPreview: {
			'whisky': '/api/dsp/preview/whisky/{id}/',
			'sweety': '/api/dsp/preview/sweety/{id}/',
			'sweetyCreative': '/api/dsp/preview/sweetyCreative/{id}/',
			'admCreative': '/api/dsp/preview/sweetyCreative?u={url}',	// 自定义物料
			'product': '#product/edit/{id}'
		},

		// 资质证件类型列表
		certificateList: [],
		// 资质证件补充信息
		certificateExtra: [
			{
				"field": "CrtId",
				"title": "文件编号",
				"type": "text"
			},
			{
				"field": "CrtBeginDate",
				"title": "开始时间",
				"type": "date"
			},
			{
				"field": "CrtEndDate",
				"title": "结束时间",
				"type": "date"
			}
		],
		// 以下证件需要检查是否填写补充信息。
		validateCrtExtra: [
			1200,1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,
			1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,1221,
			1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,
			1233,1234,1235,1236,1237,1238,1239,1240,1241,1242,1243,
			1244,1245,1246,1015,1014,1025,1008,1007,1005,1004,1054,
			1098,1051,1091,1058
		],

		// 旧
		smartMonitorIndex: [
			{Name: _T('成本'), _id: 'group', Unit: '', group: true},
			{Name: _T('总消费'), _id: 'cost', Unit: _T('元')},
			{Name: _T('CPM'), _id: 'cpm', Unit: _T('元')},
			{Name: _T('CPA'), _id: 'cpa', Unit: _T('元')},
			{Name: _T('CPC'), _id: 'cpc', Unit: _T('元')},
			{Name: _T('到达单价'), _id: 'back_reach_cost', Unit: _T('元')},
			{Name: _T('前端'), _id: 'group', Unit: '', group: true},
			{Name: _T('展示量'), _id: 'impressions', Unit: _T('次')},
			{Name: _T('点击量'), _id: 'clicks', Unit: _T('次')},
			{Name: _T('点击率'), _id: 'click_rate', Unit: _T('%'), NeedTrans: true},
			{Name: _T('点击到达率'), _id: 'click_reach_rate', Unit: _T('%'), NeedTrans: true},
			{Name: _T('转化'), _id: 'group', Unit: '', group: true},
			{Name: _T('注册率'), _id: 'back_reg_rate', Unit: _T('%'), NeedTrans: true},
			{Name: _T('竞价'), _id: 'group', Unit: '', group: true},
			{Name: _T('出价数'), _id: 'bid_num', Unit: _T('元')},
			{Name: _T('竞得率'), _id: 'win_rate', Unit: _T('%'), NeedTrans: true}
		],
		// 新-监控指标
		smartMonitorMetric: {
			// 活动
			'1': [
				{Name: _T('成本'), _id: 'group', Unit: '', group: true},
				{Name: _T('总消费'), _id: 'cost', Unit: _T('元')},
				{Name: _T('CPM'), _id: 'cpm', Unit: _T('元')},
				{Name: _T('CPA'), _id: 'cpa', Unit: _T('元')},
				{Name: _T('CPC'), _id: 'cpc', Unit: _T('元')},
				{Name: _T('到达单价'), _id: 'back_reach_cost', Unit: _T('元')},

				{Name: _T('前端'), _id: 'group', Unit: '', group: true},
				{Name: _T('展示量'), _id: 'impressions', Unit: _T('次')},
				{Name: _T('点击量'), _id: 'clicks', Unit: _T('次')},
				{Name: _T('点击率'), _id: 'click_rate', Unit: _T('%'), NeedTrans: true},
				{Name: _T('点击到达率'), _id: 'click_reach_rate', Unit: _T('%'), NeedTrans: true},

				{Name: _T('转化'), _id: 'group', Unit: '', group: true},
				{Name: _T('注册率'), _id: 'back_reg_rate', Unit: _T('%'), NeedTrans: true},

				{Name: _T('竞价'), _id: 'group', Unit: '', group: true},
				{Name: _T('出价数'), _id: 'bid_num', Unit: _T('元')},
				{Name: _T('竞得率'), _id: 'win_rate', Unit: _T('%'), NeedTrans: true}
			],
			// 广告位
			'2': [
				{Name: _T('成本'), _id: 'group', Unit: '', group: true},
				{Name: _T('总消费'), _id: 'cost', Unit: _T('元')},
				{Name: _T('CPM'), _id: 'cpm', Unit: _T('元')},
				{Name: _T('CPA'), _id: 'cpa', Unit: _T('元')},
				{Name: _T('CPC'), _id: 'cpc', Unit: _T('元')},
				{Name: _T('到达单价'), _id: 'back_reach_cost', Unit: _T('元')},

				{Name: _T('前端'), _id: 'group', Unit: '', group: true},
				{Name: _T('展示量'), _id: 'impressions', Unit: _T('次')},
				{Name: _T('点击量'), _id: 'clicks', Unit: _T('次')},
				{Name: _T('点击率'), _id: 'click_rate', Unit: _T('%'), NeedTrans: true},
				{Name: _T('点击到达率'), _id: 'click_reach_rate', Unit: _T('%'), NeedTrans: true},

				{Name: _T('落地页'), _id: 'group', Unit: '', group: true},
				{Name: _T('B_平均窗口大小'), _id: 'back_avg_pagepixels', Unit: _T('px')},
				{Name: _T('B_平均停留时间'), _id: 'back_avg_staytime', Unit: _T('秒')},

				{Name: _T('转化'), _id: 'group', Unit: '', group: true},
				{Name: _T('注册率'), _id: 'back_reg_rate', Unit: _T('%'), NeedTrans: true},
				{Name: _T('点击注册率'), _id: 'back_reg_click_rate', Unit: _T('%'), NeedTrans: true},

				{Name: _T('竞价'), _id: 'group', Unit: '', group: true},
				{Name: _T('出价数'), _id: 'bid_num', Unit: _T('元')},
				{Name: _T('竞得率'), _id: 'win_rate', Unit: _T('%'), NeedTrans: true}
			]
		},
		smartMonitorOperator: [
			{Name: _T('大于等于'), _id: '>='},
			//{Name: _T('大于'), _id: '>'},
			//{Name: _T('等于'), _id: '='},
			//{Name: _T('小于'), _id: '<'},
			{Name: _T('小于等于'), _id: '<='}
		],

		country: {
			"china": 10761
		},

		// 缺省显示指标
		defaultMetrics: [],
		// 全部指标
		allMetrics: [],
		// 拥有指标
		ownMetrics: [],
		// 缺省分组信息
		defaultGroup: null,
		// 列表指标分组配置
		metricsGroup: null,

		// raido值定义
		RAIDO_VALUE_DEFINE: {
			// 不限 (关闭)
			 'ALL': -1
			// 指定 (开启)
			,'NOT_ALL': 0
			// 包含以下条件
			,'INCLUDE': 0
			// 排除以下条件
			,'EXCLUDE': 1
		},


		CONST: CONST,
		getHashConf: function (hash) {
			var ret = false;
			util.each([report_menu, admin_menu], function (menu) {
				if (menu && menu.length) {
					util.each(menu, function (item) {
						if (item.link && hash.indexOf(item.link) > -1) {
							ret = item;
							return false;
						}
						if (item.items && item.items.length) {
							util.each(item.items, function (sub) {
								if (sub.link && hash.indexOf(sub.link) > -1) {
									ret = item;
									return false;
								}
							});

							if (ret) {
								return false;
							}
						}
					});

					if (ret) {
						return false;
					}
				}
			});

			return ret;
		},

		//登录成功后的回调方法.
		loginCb: function (app, cb) {
			//config 里的配置登录前是没有权限获取的,只能在这里再获取.
			//本想require()的, 但发现应该是cookie没来得及更新,以致再次说要求再登录.但这样就行...
			app.mc.send('user/config', function (err, data) {
				if (err) {
					app.mc.send('error/log', {message: err.message + ", 请联系开发人员", type: 'front'});
					win.location.reload();
					return false;
				}

				var user = app.getUser();
				if (data) {
					if (data.exchange) {
						var exchange = data.exchange;
						app.config('allExchange', exchange.allExchange);
						app.config('exchange', exchange.list);
						app.config('pcChannel', exchange.pc);
						app.config('mobileChannel', exchange.mobile);
						app.config('channelMap', exchange.map);
						app.config('aptitude_group', exchange.aptitude_group);
					}
					if (data.labels) {
						var labels = require('@sys_labels');
						if (labels) {
							labels = labels.labels;
							$.extend(labels.config, data.labels);
						}
					}

					if (data.metrics) {
						var metrics = data.metrics;
						app.config('defaultMetrics', metrics.defaultMetrics);
						app.config('defaultGroup', metrics.defaultGroups);
						app.config('metricsGroup', metrics.grids);
					}
					if (data.allMetrics) {
						app.config('allMetrics', data.allMetrics);
					}
					if (data.ownMetrics) {
						app.config('ownMetrics', data.ownMetrics);
					}

					if(data.categories){
						var categories = data.categories;
						app.config('certificateList', categories.certificate);
					}
					if(data.currency){
						app.config('currency', data.currency);
						app.setCurrency(data.currency);
					}
				}

				// 过滤没有权限的菜单。
				var t;
				var t_menu;
				// 品牌版
				t_menu = util.clone([report_menu_brand, admin_menu_brand]);
				dspUtil.filterMenu(t_menu, app);

				var switch_items = [];

				if(user && user.current && user.current.isAdmin){
					switch_items.push({
						text: _T('管理后台'),
						alias: _T('后台'),
						link: "#login/admin",
						class: 'admin',
						icon: 'icon-report',
						// target: '_blank'
					});
				}

				t = app.core.get('SYS_PLATFORM/switch');
				if (t) {
					if (switch_items.length) {
						// 这里构建切换模块。
						t.buildContent(switch_items);
					}
				}

				t = app.core.get('SYS_PLATFORM/menu');
				if (t) {
					// 这里构建菜单模块。
					t.buildMenu(t_menu);
				}

				t = app.core.get('SYS_PLATFORM/header/switchProduct');
				if (t) {
					// 构建可切换产品模块
					t.buildSwitchProduct();
				}

				if (cb) {
					cb();
				}
			});
		},
		grid: {
			// 排序的字段名命名,缺省叫"sort",此项目中使用"order"命名
			sortName: 'order'
		},
		history_id: '_DSP_HISTORY_UID',
	};
});